﻿<!DOCTYPE html>
<html>
 <head> 
  <meta charset="utf-8" /> 
  <title>添加老师</title> 
  <meta name="renderer" content="webkit" /> 
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> 
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" /> 
  <!-- // 样式表单--> 
  <script src="../layui/src/layui.js"></script> 
  <link href="../layui/src/css/layui.css" rel="stylesheet" /> 
  <link href="../layui/layui/css/layui.css" rel="stylesheet" /> 
  <!--上传--> 
  <script src="../js/js/jquery/jquery-1.10.2.min.js"></script> 
  <link href="../layui/layui/uploader.css" rel="stylesheet" /> 
  <script src="../layui/uploader/webuploader/webuploader.min.js"></script> 
  <script src="../layui/uploader/uploader.js"></script> 
  <style>
body{padding: 10px;}
</style> 
 </head> 
 <body > 
  <form class="layui-form layui-form-pane1" action="" lay-filter="first" id ="motto-add"> 
   <div class="layui-form-item">
            <label class="layui-form-label">添加箴言</label>
            <div class="layui-input-block">
                <input type="text" name="motto" id="motto" autocomplete="off" class="layui-input">
            </div>
        </div>
	
		
	
      <div class="layui-form-item"> 
    <div class="layui-input-block"> 
     <button class="layui-btn" lay-submit="" lay-filter="*" id="Button1" onclick="sendRequestToAddMotto()">立即提交</button> 
 
    </div> 
   </div> 
  </form> 
  <script>

      $(function () {
          //初始化上传控件
          $(".upload-img").InitUploader({ filesize: "0", sendurl: "../ChireInter/Other/Upload/fileupload.ashx", swf: "../layui/uploader/webuploader/uploader.swf", filetypes: "jpg,jpeg,png,gif,bmp" });



          $('.skin-minimal input').iCheck({
              checkboxClass: 'icheckbox-blue',
              radioClass: 'iradio-blue',
              increaseArea: '20%'
          });

          $("#form-member-add").validate({
              rules: {
                  username: {
                      required: true,
                      minlength: 2,
                      maxlength: 16
                  },
                  sex: {
                      required: true,
                  },
                  mobile: {
                      required: true,
                      isMobile: true,
                  },
                  email: {
                      required: true,
                      email: true,
                  },
                  uploadfile: {
                      required: true,
                  },

              },
              onkeyup: false,
              focusCleanup: true,
              success: "valid",
              submitHandler: function (form) {
                  //$(form).ajaxSubmit();
                  var index = parent.layer.getFrameIndex(window.name);
                  //parent.$('.btn-refresh').click();
                  parent.layer.close(index);
              }
          });
      });

      function sendRequestToAddMotto() {
          $.ajax({
              cache: true,
              type: "POST",
              url: "../ChireInter/Motto/Motto_Add.ashx",
              data: $('#motto-add').serialize(),
              async: false,
              error: function (request) {
                  layer.alert('error');
              },
              success: function (data) {
                  data = $.parseJSON(data);
                  if (data.success) {
                      layer.alert('成功', function (index) {
                          location.reload();
                      });
                  } else {
                      layer.alert(data.resultMsg);
                      return;
                  }
              }
          });
      }

  </script>   
 </body>
</html>





